package com.gnerv.rabbitmq.agent.command;

import com.gnerv.rabbitmq.agent.model.entity.Node;
import com.gnerv.rabbitmq.agent.tools.ExecTools;
import com.google.common.collect.Lists;

import java.util.List;

/**
 * @author Gnerv LiGen
 */
public class RabbitmqDiagnosticsCommand extends AbstractRabbitmqDiagnosticsCommand {

    public RabbitmqDiagnosticsCommand(Node node) {
        super();
        setNode(node);
    }

    public static RabbitmqDiagnosticsCommand build(Node node) {
        return new RabbitmqDiagnosticsCommand(node);
    }

    public ExecTools.ExecResult serverVersion(String nodeName) {
        List<String> listVhosts = Lists.newArrayList();
        listVhosts.add("-n");
        listVhosts.add(nodeName);
        listVhosts.add("server_version");
        listVhosts.add("-q");
        return run(listVhosts);
    }

}
